package com.jt.trffic.balance.serial;

import org.springframework.stereotype.Component;

/**
 * 秤串口监听
 */
@Component
public class BalaceSerialService {
    private static SerialPort serialPort = null;
    private static void init() {
        try {
            serialPort16 = SerialTool.openPort("COM1", 9600);
            serialPort23 = SerialTool.openPort("COM3", 9600);
            isInit = true;
        } catch (SerialPortParameterFailure serialPortParameterFailure) {
            serialPortParameterFailure.printStackTrace();
        } catch (NotASerialPort notASerialPort) {
            notASerialPort.printStackTrace();
        } catch (NoSuchPort noSuchPort) {
            noSuchPort.printStackTrace();
        } catch (PortInUse portInUse) {
            portInUse.printStackTrace();
        }
    }
}
